home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Utilities / Programming / EnterAct 3.7.3 / EnterAct Code Templates next >
Text File  |  1996-06-14  |  4KB  |  277 lines

  1. About templates and this file format
  2. ------------------------------------
  3. If you didn't read the manual, you'll want to know how to use this:
  4. type the name of an entry, then hit <command><return> to replace
  5. the name with its template. To advance to the next logical insertion
  6. point, keep hitting <command><return>. Case counts in the template name.
  7.  
  8. hAWK templates are a special case (see the first entries below): if your
  9. entry name expands to something that starts with "hAWK", EnterAct will
  10. select all of it instead of advancing the insertion point. And if you
  11. press <command><return> with a hAWK template selected, EnterAct will
  12. run the hAWK program. You can also press <enter> to run a selected program.
  13.  
  14. If you change and save this file with EnterAct, changes take effect
  15. immediately (no need to restart EnterAct). Keep this file in the same
  16. folder where you have EnterAct, at the same level, and don't change its name.
  17.  
  18. Please change this file to suit your needs--just follow the rules below.
  19. Feel free to add or delete entries, or change entry names or contents.
  20.  
  21. Keep each entry in an ENTRY/END sandwich. Following ENTRY, on a new line
  22. put the name of the template--note it can contain any non-blank characters.
  23. Put the template (or definition if you like) for the name on a new line
  24. immediately below the name line. Each template ends with "END" on a new
  25. line. Arbitrary text like this is OK between entries (just don't start any
  26. comment line, or for that matter any line inside a template,
  27. with "ENTRY" or "END").
  28.  
  29. If you put the special symbol '@' in your template, then insertion
  30. point advances (automatic when you put in a template, command-return
  31. thereafter) will stop at the '@' and select it. Non-code insertion points
  32. should be specially marked with '@', but you mostly don't have to specially
  33. mark obvious places in a C or C++ code template.
  34.  
  35. Keep all your entries flush-left, and EnterAct will adjust your indentation
  36. when pasting your template in. Just open up a new line and tab in to the
  37. right position before typing the entry name and pressing <command><return>.
  38.  
  39. Tip: if you change your templates a lot, add this file to your "Locations" menu.
  40.  
  41.  
  42. First up, some hAWK templates:
  43. ENTRY
  44. echo
  45. hAWK -f$EchoFullPathNames -- MFS
  46.  
  47. END
  48. ENTRY
  49. compare
  50. hAWK -f$CompareFiles -- MFS
  51.  
  52. END
  53. ENTRY
  54. boiler
  55. hAWK -f$BoilerPlate -vputInComment=1 -vfile="@.c"
  56.     -vauthor="KE" -vcompany="bdibdi" -ss
  57.  
  58. END
  59.  
  60. ENTRY
  61. time
  62. hAWK -f$Time
  63.  
  64. END
  65.  
  66. ENTRY
  67. ff
  68. hAWK -f$FormatFunctionIntro
  69.  
  70. END
  71.  
  72. Some standard templates:
  73.  
  74. ENTRY
  75. for
  76. for (; ; )
  77.     {
  78.     
  79.     }
  80.  
  81. END
  82. ENTRY
  83. fori
  84. for (i = 0; i < @; ++i)
  85.     {
  86.     
  87.     }
  88.  
  89. END
  90. ENTRY
  91. while
  92. while ()
  93.     {
  94.     
  95.     }
  96.  
  97. END
  98. ENTRY
  99. switch
  100. switch ()
  101.     {
  102. case :
  103.     
  104. break;
  105. default:
  106. break;
  107.     }
  108.  
  109. END
  110. ENTRY
  111. switch'
  112. switch ()
  113.     {
  114. case '':
  115.     
  116. break;
  117. default:
  118. break;
  119.     }
  120.  
  121. END
  122. ENTRY
  123. if
  124. if ()
  125.     {
  126.     
  127.     }
  128.  
  129. END
  130. ENTRY
  131. else
  132. else
  133.     {
  134.     
  135.     }
  136.  
  137. END
  138. ENTRY
  139. ife
  140. if ()
  141.     {
  142.     
  143.     }
  144. else
  145.     {
  146.     
  147.     }
  148.  
  149. END
  150. ENTRY
  151. iff
  152. if ()
  153.     {
  154.     
  155.     }
  156. else if ()
  157.     {
  158.     
  159.     }
  160.  
  161. END
  162. ENTRY
  163. elif
  164. else if ()
  165.     {
  166.     
  167.     }
  168.  
  169. END
  170. ENTRY
  171. do
  172. do
  173.     {
  174.     
  175.     } while ();
  176.  
  177. END
  178. ENTRY
  179. struct
  180. typedef struct @
  181.     {
  182.     ;    //
  183.     } @, *@Ptr;
  184.  
  185. END
  186.  
  187. If you type something a lot--make a template for it!
  188. Error checking, maybe...
  189. ENTRY
  190. e
  191. if (theErr == noErr)
  192.     {
  193.     
  194.     }
  195.  
  196. END
  197. ...or looping a lot
  198. ENTRY
  199. while--
  200. while (--@ >= 0)
  201.     {
  202.     
  203.     }
  204.  
  205. END
  206.  
  207. A quick&dirty file top (see "boiler" above if you want a time stamp)
  208. ENTRY
  209. top
  210. /****
  211.     File.....:     @
  212.     Date.....:     @, 1996
  213.     .........:   © 1996 yourCompany / yourname. All rights reserved.
  214.     Status...:     under development
  215.     Spec.....:     @
  216. ****/
  217.  
  218. END
  219. ENTRY
  220. i
  221. #include "@.h"
  222.  
  223. END
  224.  
  225. Make a quick comment by typing just a forward slash, then cmd-return:
  226. ENTRY
  227. /
  228. /* @
  229. */
  230. END
  231.  
  232. Start up a function definition
  233. ENTRY
  234. func
  235. /* @
  236. */
  237. OSErr @
  238.     (,    //
  239.         //
  240.     )
  241.     {
  242.     
  243.     
  244.     
  245.     }
  246.  
  247. END
  248.  
  249. Dereference a Handle
  250. ENTRY
  251. d
  252. (**@).@
  253. END
  254.  
  255. An HTML template
  256. ENTRY
  257. html
  258. <HTML>
  259.  
  260. <HEAD>
  261. <TITLE>@</TITLE>
  262. </HEAD>
  263.  
  264. <BODY>
  265.  
  266. <H1>@</H1>
  267.  
  268. <P>@</P>
  269.  
  270. </BODY>
  271.  
  272. </HTML>
  273.  
  274. END
  275.  
  276. OK, your turn...a template for a class or enum, perhaps?
  277.